var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
    })(t, e);
}, function(t, e) {
    function r() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (r.prototype = e.prototype, 
    new r());
}), a = this && this.__decorate || function(t, e, o, r) {
    var i, n = arguments.length, s = n < 3 ? e : null === r ? r = Object.getOwnPropertyDescriptor(e, o) : r;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, o, r); else for (var a = t.length - 1; 0 <= a; a--) (i = t[a]) && (s = (n < 3 ? i(s) : 3 < n ? i(e, o, s) : i(e, o)) || s);
    return 3 < n && s && Object.defineProperty(e, o, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("VideoAdManager"), s = cc._decorator, c = s.ccclass, l = s.property, d = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.tag = "money", t.title = "视频领取冷却：", t.timeLabel = null, t.type = 1, t.time = 0, 
        t.callback = null, t.isDestroy = !1, t;
    }
    return i(t, e), t.prototype.onLoad = function() {
        this.refresh();
    }, t.prototype.start = function() {}, t.prototype.doDestroy = function() {
        this.isDestroy || (cc.log("doDestroy"), this.isDestroy = !0, this.unscheduleAllCallbacks(), 
        this.callback && this.callback(), this.node && this.node.destroy());
    }, t.prototype.refresh = function() {
        var t, e;
        r.default.getInstance().check(this.tag) ? this.doDestroy() : (this.node.active = !0, 
        t = r.default.getInstance().getConfig(this.tag), e = r.default.getInstance().getData(this.tag), 
        this.time = e.time + 1e3 * t.interval, this.unscheduleAllCallbacks(), this.refreshLabel(), 
        this.schedule(this.refreshLabel, 1));
    }, t.prototype.refreshLabel = function() {
        var t = Math.floor((this.time - Date.now()) / 1e3);
        0 <= t ? this.timeLabel.string = this.title + this.parseTime(t) : this.doDestroy();
    }, t.prototype.parseTime = function(t) {
        var e, o, r = "";
        1 === this.type ? (r += (e = Math.floor(t / 60)) < 10 ? "0" + e : e, r += ":") : 2 === this.type && (r += (o = Math.floor(t / 3600)) < 10 ? "0" + o : o, 
        r += ":", r += (e = Math.floor(t % 3600 / 60)) < 10 ? "0" + e : e, r += ":");
        t %= 60;
        return r + (t < 10 ? "0" + t : t);
    }, a([ l ], t.prototype, "tag", void 0), a([ l ], t.prototype, "title", void 0), 
    a([ l(cc.Label) ], t.prototype, "timeLabel", void 0), a([ l ], t.prototype, "type", void 0), 
    a([ c ], t);
}(cc.Component);

n.default = d;